﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ElectricPull : SimpleItems_Animator, IElevatorBtn
{
    [SerializeField] private Elevator elevator;
    /// <summary>
    /// -99则为不移动
    /// </summary>
    [SerializeField] private Vector2 target1 = new Vector2(-99, -99);
    [SerializeField] private Vector2 target2 = new Vector2(-99, -99);

    [SerializeField] private bool readyToTarget1 = false;


    protected override void OnAnimationEnd()
    {
        base.OnAnimationEnd();
        if (readyToTarget1)
        {
            elevator.MoveTo(target1, this);
        }
        else
        {
            elevator.MoveTo(target2, this);
        }
        readyToTarget1 = !readyToTarget1;

    }


    private SimpleElectricalEquipment electricalEquipment;

    protected override void Awake()
    {
        base.Awake();
        electricalEquipment = GetComponent<SimpleElectricalEquipment>();
    }

    public void Off()
    {
       
    }

    public override void Interactive()
    {
        if (!((electricalEquipment==null|| electricalEquipment.isOpen) && elevator.isOpen))
            return;
        base.Interactive();
        
    }




}
